import Vue from 'vue'
import Router from 'vue-router'
import renzheng from '../components/WX/renzheng'
import gerengongzi from '../components/WX/gerengongzi'

Vue.use(Router)


const router = new Router({
	routes: [
	{
		path: '/renzheng',

		component: renzheng
	},{
		path: '/userinfo',

		component: gerengongzi
	}
	]
})
router.beforeEach((to, from, next) => {
	console.log(to)
	if (to.path!="/renzheng") {
		if (localStorage.userinfo) {
			next()
			console.log('tiaozhuan1')
		}
		else{
			
			next({
				path: '/renzheng',
				query: { redirect: to.fullPath }

			});
			
		}
	}else {
		next()
	}
})
export default router